<template>
  <div class="app-container">
    <div class="app-title">
      <span>财政审核</span>
    </div>
    <el-row :gutter="20">
      <el-col :span="8">
        <el-col :span="1">
          <i :class="[treeShow ? 'el-icon-s-fold treeI' : 'el-icon-s-unfold treeI']" @click="toggerTree" />
        </el-col>
        <div class="tap-fillet">
          <el-radio-group v-model="activeName" style="margin-left:4rem; width:700px; height:15px; margin-top:-67px ">
            <el-radio-button label="all" name="didNotReport">全部</el-radio-button>
            <el-radio-button label="1" name="report">审核</el-radio-button>
          </el-radio-group>
        </div>
      </el-col>
      <div class="filter-container">
        <el-col style="text-align:right;margin-top: -3px;" :span="16">
          <el-button size="small" class="filter-item" style="margin-left: 10px;" type="primary" @click="Query">
            查询
          </el-button>
          <el-button v-if="activeName === '1'" size="small" class="filter-item" style="margin-left: 10px;"
            type="primary" @click="Pass">
            审核
          </el-button>
          <el-button v-if="activeName === '1'" size="small" class="filter-item" style="margin-left: 10px;"
            type="primary" @click="Reject">
            退回
          </el-button>
        </el-col>

      </div>
    </el-row>
    <div>
      <div style="margin-left:150px; position:absolute; margin-top:-43px">
        <img style="width:16px; height:16px;" :src="Processedimg">
      </div>
      <div style="margin-left:75px; position:absolute; margin-top:-43px">
        <img style="width:16px; height:16px;" :src="Untreatedimg">
      </div>
    </div>
    <div ref="box" class="box">
      <div class="left" :class="[isActive ? 'wid' : 'wids']">
        <div :class="[treeShow ? 'treeShow' : 'treeNotShow']" :style="{ 'height': treeHeight + 'px' }">
          <AgencyTree class="agencyTree" @handleTreeQuery="handleTreeQuery" />
        </div>
      </div>
      <div v-show="Show" class="resize" title="收缩侧边栏" />
      <div class="mid" :class="[isActive ? 'mids' : 'min']">
        <financialAuditChildren :key="timer" ref="chil" :tab-pane="activeName" />
      </div>
      <Drag ref="icon" />

    </div>
  </div>

</template>

<script>
import financialAuditChildren from '@/views/financialAudit/children/financialAuditChildren'
import AgencyTree from '@/components/tree/agencyTree'
import Drag from '@/components/Drag'
export default {
  name: 'FinancialAudit',
  components: { financialAuditChildren, AgencyTree, Drag },
  data() {
    return {
      treeHeight: null,
      Show: false,
      isActive: true,
      treeShow: false,
      timer: '',
      activeName: 'all',
      Untreatedimg: require('@/assets/images/whiteall.png'),
      Processedimg: require('@/assets/images/blueselect.png')
    }
  },
  watch: {
    activeName(val) {
      this.timer = new Date().getTime()
      if (val === '0') {
        this.Processedimg = require('@/assets/images/blueselect.png')
        this.Untreatedimg = require('@/assets/images/whiteall.png')
      } else {
        this.Processedimg = require('@/assets/images/select.png')
        this.Untreatedimg = require('@/assets/images/all.png')
      }
    }
  },
  mounted() {
    this.dragController()
    this.getTeHeight()
  },
  beforeMount() {
    window.addEventListener('resize', this.getTeHeight)
  },
  created() { },
  methods: {
    getTeHeight() {
      this.treeHeight = window.innerHeight - 270
    },
    // 拖拽
    dragController() {
      this.$refs.icon.dragControllerDiv()
    },
    // 树显隐方法
    toggerTree() {
      this.treeShow = !this.treeShow
      this.isActive = !this.isActive
      this.Show = !this.Show
    },
    // 树方法
    handleTreeQuery(data) {
      this.$refs.chil.handleTree(data)
    },
    // 查询
    Query() {
      this.$refs.chil.query()
    },
    Reject() {
      this.$refs.chil.auditReject()
    },
    Pass() {
      this.$refs.chil.auditPass()
    }
  }
}
</script>

